Dynomotion

Group: DynoMotion Message: 12338 From: Colin Fera Date: 10/2/2015
Subject: strange limit switch and following error behavior
I am getting inconsistent limit switch and following error behavior while tuning.

I am using the opto-ins on the kanalog for the limit switches.  With the limit switches configured to stop movement, negative bit as the actual limit switch bit (both + and -) positive bit as the estop bit.  Looking at the digital I/O window I see all switches are active (configured for active low).

When I try to make a move in the step response window I will get negative switch axis disabled, consistently only for a single axis. Rebooting the kflop changes the axis which gets disabled sometimes. 

On the following error, with the following error max set to 256 for all axis's, the actual drives powered off and the max error set to 300.  Only axis 2 disables with a following error um error.

I would expect it to be consistent for all the drives.

Any thoughts?

here is the init that I am building.

All the axis are set the same because I have only tuned one axis so far and am trying to overcome this inconsistent behavior before I continue.

main()
{
  // SetSoftLim(0);
 
    ch0->SoftLimitPos= 10000;      
    ch0->SoftLimitNeg=-10000;        
    ch1->SoftLimitPos=10000;        
    ch1->SoftLimitNeg=-10000;      
    ch2->SoftLimitPos=10000;      
    ch2->SoftLimitNeg=-10000;
       
    DefineCoordSystem(0,1,2,-1);
           
    ch0->InputMode=ENCODER_MODE;
    ch0->OutputMode=DAC_SERVO_MODE;
    ch0->Vel=200000.000000;
    ch0->Accel=550000.000000;
    ch0->Jerk= 18000000.000000;
    ch0->P=12.26;
    ch0->I=.0006;
    ch0->D=105;
    ch0->FFAccel=0.0003;
    ch0->FFVel=0.008;
    ch0->MaxI=200.000000;
    ch0->MaxErr=100.000000;
    ch0->MaxOutput=1000.000000;
    ch0->DeadBandGain=0.000000;
    ch0->DeadBandRange=4.000000;
    ch0->InputChan0=0;
    ch0->InputChan1=0;
    ch0->OutputChan0=0;
    ch0->OutputChan1=0;
    ch0->LimitSwitchOptions=12f;
    ch0->LimitSwitchNegBit=138;
    ch0->LimitSwitchPosBit=139;
    ch0->InputGain0=1.000000;
    ch0->InputGain1=1.000000;
    ch0->InputOffset0=0.000000;
    ch0->InputOffset1=0.000000;

    ch0->MaxFollowingError=256.000000;
   


    ch0->iir[0].B1=0.000000;
    ch0->iir[0].B2=0.000000;
    ch0->iir[0].A1=0.000000;
    ch0->iir[0].A2=0.000000;

    ch0->iir[1].B0=1.000000;
    ch0->iir[1].B1=0.000000;
    ch0->iir[1].B2=0.000000;
    ch0->iir[1].A1=0.000000;
    ch0->iir[1].A2=0.000000;

    ch0->iir[2].B0=0.056495;
    ch0->iir[2].B1=0.112989;
    ch0->iir[2].B2=0.056495;
    ch0->iir[2].A1=1.225650;
    ch0->iir[2].A2=-0.451634;


   
    ch1->InputMode=ENCODER_MODE;
    ch1->OutputMode=DAC_SERVO_MODE;
    ch1->Vel=200000.000000;
    ch1->Accel=550000.000000;
    ch1->Jerk= 18000000.000000;
    ch1->P=12.26;
    ch1->I=.0006;
    ch1->D=105;
    ch1->FFAccel=0.0003;
    ch1->FFVel=0.008;
    ch1->MaxI=200.000000;
    ch1->MaxErr=100.000000;
    ch1->MaxOutput=1000.000000;
    ch1->DeadBandGain=0.000000;
    ch1->DeadBandRange=4.000000;
    ch1->InputChan0=1;
    ch1->InputChan0=1;
    ch1->InputChan1=1;
    ch1->OutputChan0=1;
    ch1->OutputChan1=1;
    ch1->LimitSwitchOptions=12f;
    ch1->LimitSwitchNegBit=137;
    ch1->LimitSwitchPosBit=139;
    ch1->InputGain0=1.000000;
    ch1->InputGain1=1.000000;
    ch1->InputOffset0=0.000000;
    ch1->InputOffset1=0.000000;

    ch1->MaxFollowingError=256.000000;


    ch1->iir[0].B1=0.000000;
    ch1->iir[0].B2=0.000000;
    ch1->iir[0].A1=0.000000;
    ch1->iir[0].A2=0.000000;

    ch1->iir[1].B0=1.000000;
    ch1->iir[1].B1=0.000000;
    ch1->iir[1].B2=0.000000;
    ch1->iir[1].A1=0.000000;
    ch1->iir[1].A2=0.000000;

    ch1->iir[2].B0=0.056495;
    ch1->iir[2].B1=0.112989;
    ch1->iir[2].B2=0.056495;
    ch1->iir[2].A1=1.225650;
    ch1->iir[2].A2=-0.451634;


   
    ch2->InputMode=ENCODER_MODE;
    ch2->OutputMode=DAC_SERVO_MODE;
    ch2->Vel=200000.000000;
    ch2->Accel=550000.000000;
    ch2->Jerk= 18000000.000000;
    ch2->P=12.26;
    ch2->I=.0006;
    ch2->D=105;
    ch2->FFAccel=0.0003;
    ch2->FFVel=0.008;
    ch2->MaxI=200.000000;
    ch2->MaxErr=100.000000;
    ch2->MaxOutput=1000.000000;
    ch2->DeadBandGain=0.000000;
    ch2->DeadBandRange=4.000000;
    ch2->InputChan0=2;
    ch2->InputChan1=2;
    ch2->OutputChan0=2;
    ch2->OutputChan1=2;
    ch2->LimitSwitchOptions=12f;
    ch2->LimitSwitchNegBit=136;
    ch2->LimitSwitchPosBit=139;
    ch2->InputGain0=1.000000;
    ch2->InputGain1=1.000000;
    ch2->InputOffset0=0.000000;
    ch2->InputOffset1=0.000000;

    ch2->MaxFollowingError=256.000000;



    ch2->iir[0].B1=0.000000;
    ch2->iir[0].B2=0.000000;
    ch2->iir[0].A1=0.000000;
    ch2->iir[0].A2=0.000000;

    ch2->iir[1].B0=1.000000;
    ch2->iir[1].B1=0.000000;
    ch2->iir[1].B2=0.000000;
    ch2->iir[1].A1=0.000000;
    ch2->iir[1].A2=0.000000;

    ch2->iir[2].B0=0.056495;
    ch2->iir[2].B1=0.112989;
    ch2->iir[2].B2=0.056495;
    ch2->iir[2].A1=1.225650;
    ch2->iir[2].A2=-0.451634;
   
      EnableAxisDest(Y,0);  //y
      EnableAxisDest(X,0);   //z
      EnableAxisDest(Z,0);   //x 
}


Group: DynoMotion Message: 12340 From: Tom Kerekes Date: 10/2/2015
Subject: Re: strange limit switch and following error behavior
Hi Colin,

One possibility would be noise on the negative limit inputs.  How are they wired and driven?  Can you disconnect or wire them with short wiring temporarily as a test?

Regarding following error:  What are the actual following errors?  How far are you moving to generate the following error?   What are the Positions and Destinations?

I assume you have defines X, Y, and Z somewhere not shown? 

Regards
TK

Group: DynoMotion Message: 12344 From: Colin Fera Date: 10/2/2015
Subject: Re: strange limit switch and following error behavior
Hi Tom,

Thanks for the reply.

Regarding the following error, the drives are not powered therefore there is no encoder feedback and no movement so the actual following error is whatever is commanded. 

If I have max following error set at 256 and in kmotion step response I command a 1000 step move, Chanel 2 disables with a console output of "Following Error Disabled Axis:2" with a dest of 256.x, this what I am expecting to happen.

If I do the same thing for channel 1 and channel 0, I don't get the same result (those channels don't disable yet on the step response graph the output is clearly shown).  There must be some reason for this that I am missing.

I am worried about attempting to operate the machine if following error doesn't disable the axis.


Regarding the limit switches they are connected like this :

+12v-------(OPTOIN+)      (OPTOIN-)-----(NC Limit Switch)------(GND)

The wire to the switch is shielded twisted pair, and the shielding is tied to earth ground.

It was connected in the same way when I was using with steppers and I never had an issue but I can certainly try as you suggested.

Also I cut off this portion:

#define X 0
#define Y 1
#define Z 2

Thanks,
Colin





On Fri, Oct 2, 2015 at 3:45 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Colin,

One possibility would be noise on the negative limit inputs.  How are they wired and driven?  Can you disconnect or wire them with short wiring temporarily as a test?

Regarding following error:  What are the actual following errors?  How far are you moving to generate the following error?   What are the Positions and Destinations?

I assume you have defines X, Y, and Z somewhere not shown? 

Regards
TK

Group: DynoMotion Message: 12345 From: Tom Kerekes Date: 10/2/2015
Subject: Re: strange limit switch and following error behavior
Hi Colin,

I did just notice that the limits are configured incorrectly.

ch0->LimitSwitchOptions=12f;

12f should be specified as a hexadecimal number by prefix of 0x. In C 12f means decimal 12 as a floating point number. I think this may result in using bit 0 for limits. Because bit 0 is an encoder input the result might be unpredictable. Change this (and the others) to:

ch0->LimitSwitchOptions=0x12f;

It would probably be better to let KMotion create the C code for you.

Regarding the max following error limit you should realize that when moving with the KMotion Step Response Screen the settings in the screens are what matter. As those are downloaded to KFLOP before the Move overwriting any settings that may have been set by previously executing a C program. So make sure you have the value on the Config/Flash Screen set to 256.

HTH
Regards
TK

> On Oct 2, 2015, at 9:38 PM, Colin Fera colin.fera@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
>
> ch0->LimitSwitchOptions=12f;
Group: DynoMotion Message: 12346 From: Colin Fera Date: 10/3/2015
Subject: Re: strange limit switch and following error behavior
Thanks Tom,

Good catch, that was the problem.

-Colin

On Fri, Oct 2, 2015 at 11:40 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Colin,

I did just notice that the limits are configured incorrectly.

ch0->LimitSwitchOptions=12f;

12f should be specified as a hexadecimal number by prefix of 0x. In C 12f means decimal 12 as a floating point number. I think this may result in using bit 0 for limits. Because bit 0 is an encoder input the result might be unpredictable. Change this (and the others) to:

ch0->LimitSwitchOptions=0x12f;

It would probably be better to let KMotion create the C code for you.

Regarding the max following error limit you should realize that when moving with the KMotion Step Response Screen the settings in the screens are what matter. As those are downloaded to KFLOP before the Move overwriting any settings that may have been set by previously executing a C program. So make sure you have the value on the Config/Flash Screen set to 256.

HTH
Regards
TK

> On Oct 2, 2015, at 9:38 PM, Colin Fera colin.fera@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
>
> ch0->LimitSwitchOptions=12f;